<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2230：[Neerc2006]Fool's Game
</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Neerc2006]Fool's Game
</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Neerc2006]Fool's Game
</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Neerc2006]Fool's Game
                </h1>
                <p>时间限制：30s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：259MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p>有一种纸牌游戏叫”Fool’s Game”，其规则是这样的：
&#61548;	使用4种花色的6,7,8,9,10,J,Q,K,A共36张牌，牌的大小按照从左到右依次变大。有一种花色是主牌，主牌比所有副牌都大。
&#61548;	打牌的过程双方都可以看到对方的牌，以及桌上的牌，以及已经被丢弃的牌。
&#61548;	在一轮游戏中，由一方出牌，一方跟牌。一轮游戏进程如下：
&#61550;	首先，出牌方甩出若干相同大小的牌。
&#61550;	当出牌方甩出牌之后，跟牌方应该对每一张新出的牌都用一张自己的牌跟上去，这张跟上去的牌必须比被跟的牌大。
&#61550;	如果桌上所有牌都成功被跟，出牌方必须在甩出至少一张牌，且甩出的牌的分值必须在桌上已经出现过。
&#61550;	如果某一轮出牌方甩牌之后，跟牌方不能或不愿意跟掉这些牌，则出牌方还可以选择再甩出若干张牌（这些牌的分值必须在桌上已经出现过）。然后，出牌方赢得这一轮，桌上所有牌归该跟牌方所有。双方的角色不变，进入下一轮游戏。
&#61550;	如果某一轮跟牌方完成跟牌之后，出牌方不能或不愿意再甩牌，则跟牌方赢得这一轮游戏。桌上所有牌被丢弃，双方交换出牌、跟牌角色后进入下一轮游戏。
&#61550;	任何一个时刻，桌上未被跟的牌的数量不能超过跟牌方手中的牌的数量。
&#61548;	游戏的胜负这样判定：
&#61550;	如果某一轮结束之后，一方手中无牌而另一方手中有牌，则无牌的一方胜。
&#61550;	如果某一轮结束之后双方手中都无牌，则在刚刚结束的那一轮中出牌的一方获胜。
给出一开始每给人手上的牌，判断哪一方获胜。（第一个人在第一轮中出牌）。
限制
&#61548;	每个人手中的牌的数量不超过6张。
</p><hr/><h3>输入格式</h3><p>The first line of the input file contains n1 and n2 — the number of cards that each of the players has in the beginning of the round (1 ≤ n1, n2 ≤ 6), and the trump suit (suit is specified using one letter: ‘S’ for spades, ‘C’ for clubs, ‘D’ for diamonds, ‘H’ for hearts).

The second line contains n1 card descriptions — the cards of the first player. Each card is specified by its rank (‘6’…‘9’, ‘T’ for 10, ‘J’ for Jack, ‘Q’ for Queen, ‘K’ for King, ‘A’ for Ace) followed by its suit. The third line contains n2 card descriptions — the cards of the covering player. The first player is the starting player in the first round.

All cards in players’ hands are different.

</p><hr/><h3>输出格式</h3><p>Output “FIRST” if the first player wins the game, or “SECOND” if the second player does.

</p><hr/><h3>样例输入</h3><pre>sample input #1
2 2 S
KC AD
6S 7S

sample input #2
2 2 D
KC AD
6S 7S

sample input #3
4 5 C
AS 6S 7S 8S
9S TS JS QS KS

sample input #4
3 2 C
6H JS JD
AD 6C
</pre><hr/><h3>样例输出</h3><pre>sample output #1
SECOND

sample output #2
FIRST

sample output #3
SECOND

sample output #4
FIRST
</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>Neerc2006</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2230" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2230" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>